Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean stopping with CTRL+C #3

Closed
wants to merge 1 commit into from

Conversation

dabuchera
Copy link

In raw mode, CTRL+C, which typically generates a SIGINT (interrupt signal) to terminate a process, will not function as it normally does. The raw mode is defined by that: rl.input.setMode(tty.constants.MODE_RAW)

I would therefore suggest to add process.stop() for both CTRL+C and CTRL+D

Could be a Windows problem but does including it would not harm other OS.

Best

@kasperisager
Copy link
Contributor

kasperisager commented Apr 28, 2024

The module only deals with line editing, not process control. Whether or not the process should terminate upon closing the readline interface is a caller concern and not something the module should have an opinion on.

As an example, take a look at the close handler in bare-repl, which closes the standard I/O of the process, causing it to terminate: https://github.com/holepunchto/bare-repl/blob/a0c13fd2b8f3e3ea1cd7c2f500ce765b45edfef4/index.js#L50-L57

@dabuchera
Copy link
Author

Nice. Thanks. Perhaps it would be good to mention this in the readme for isolated use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants